By popular demand: Attached find on-demand AutoDeclare.dxl v1.3 to turn on or off or preserve the current AutoDeclare setting. Comments therein are very verbose, as is usual for me. The last few lines show how to code turning it on or off. -Louie llandale - Thu Sep 04 10:39:33 EDT 2014 |
Re: AutoDeclare.dxl Script Here are some related library functions. Verbose as usual. fDXLSettings_Set() and _Get() are particulary useful as explained therein. Attachments DxlSettings.inc |
Re: AutoDeclare.dxl Script Hello Louie
For me it seems, that this command will only be evalutated if the script terminates. Try to run the following script
XFLAGS_ |= AutoDeclare_; bool bAutoIsOn = (XFLAGS_ & AutoDeclare_ != 0) i = 12; print bAutoIsOn ":" i "\n"; XFLAGS_ &= ~AutoDeclare_; bAutoIsOn = (XFLAGS_ & AutoDeclare_ != 0) int j = 20; print bAutoIsOn ":" j "\n"; It will run only one time or not at all. But now try:
eval_("XFLAGS_ |= AutoDeclare_");
bool bAutoIsOn = (XFLAGS_ & AutoDeclare_ != 0)
i = 12;
print bAutoIsOn ":" i "\n";
eval_("XFLAGS_ &= ~AutoDeclare_");
bAutoIsOn = (XFLAGS_ & AutoDeclare_ != 0)
int j = 20;
print bAutoIsOn ":" j "\n";
eval_("XFLAGS_ |= AutoDeclare_");
And you can start it over and over again Best regards Wolfgang |
Re: AutoDeclare.dxl Script Wolfgang Uhr - Thu Sep 04 11:53:01 EDT 2014 Hello Louie
For me it seems, that this command will only be evalutated if the script terminates. Try to run the following script
XFLAGS_ |= AutoDeclare_; bool bAutoIsOn = (XFLAGS_ & AutoDeclare_ != 0) i = 12; print bAutoIsOn ":" i "\n"; XFLAGS_ &= ~AutoDeclare_; bAutoIsOn = (XFLAGS_ & AutoDeclare_ != 0) int j = 20; print bAutoIsOn ":" j "\n"; It will run only one time or not at all. But now try:
eval_("XFLAGS_ |= AutoDeclare_");
bool bAutoIsOn = (XFLAGS_ & AutoDeclare_ != 0)
i = 12;
print bAutoIsOn ":" i "\n";
eval_("XFLAGS_ &= ~AutoDeclare_");
bAutoIsOn = (XFLAGS_ & AutoDeclare_ != 0)
int j = 20;
print bAutoIsOn ":" j "\n";
eval_("XFLAGS_ |= AutoDeclare_");
And you can start it over and over again Best regards Wolfgang Just to be clear and precise. A change to the XFLAGS will not be executed when the script ends! It will be executed immediately and have immediate effect! However the XFLAGS only affects the 'parsing' of DXL code, but not the execution. Therefore it will not effect the (already parsed) code in the current DXL context, but all new DXL contexts that are executed afterwards. I.e. eval_ or checkDXL ...:
XFLAGS_ |= AutoDeclare_
eval_ ("i = 20") // will succeed
XFLAGS_ &= ~AutoDeclare_
eval_ ("i = 20") // will fail
Regards, Mathias |